{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 71,
   "metadata": {},
   "outputs": [],
   "source": [
    "import math;\n",
    "class Solution(object):\n",
    "    def countType():\n",
    "        input_num = input(\"Enter your number!\")\n",
    "        input_num = int(input_num)\n",
    "        sum = 0\n",
    "        for i in range(1,math.floor(input_num/2)+1):\n",
    "            number_1 = input_num - i*2 # 1的个数  ,i代表2的个数\n",
    "            number_all = number_1 + i  # 1和2的总个数，相当于位置个数\n",
    "            count = 1\n",
    "            for k in range(number_all-i+1 , number_all+1):\n",
    "                count = count*k\n",
    "            \n",
    "            for j in range(1,i+1):\n",
    "                count = count//j\n",
    "            sum = sum + count\n",
    "            print(sum)\n",
    "        print(sum+1) "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 70,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "5"
      ]
     },
     "execution_count": 70,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "math.floor(5)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 72,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Enter your number!10\n",
      "9\n",
      "37\n",
      "72\n",
      "87\n",
      "88\n",
      "89\n"
     ]
    }
   ],
   "source": [
    "Solution.countType()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 73,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Help on method raw_input in module ipykernel.kernelbase:\n",
      "\n",
      "raw_input(prompt='') method of ipykernel.ipkernel.IPythonKernel instance\n",
      "    Forward raw_input to frontends\n",
      "    \n",
      "    Raises\n",
      "    ------\n",
      "    StdinNotImplentedError if active frontend doesn't support stdin.\n",
      "\n"
     ]
    }
   ],
   "source": [
    "help(input)"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.5.5"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
